$m(function (args) {
    //这是frame_manage的js
    var data = args.job;
    var serviceName = data.trigger.name;
    var title = data.trigger.name;
    $('.rs-right-top span[id="belong_workspace"]').attr("title", data.workspaceName);
    $('.rs-right-top span[id="belong_theme"]').attr("title", data.applicationName);
    $('#ca-name').attr("title", title);
    var creator = data.creatorName;
    if (creator.length > 6) {
        creator = creator.substr(0, 7) + "...";
    }
    if (serviceName.length > 30) {
        serviceName = serviceName.substring(0, 29) + "...";
    }
    $("#ca-name").text(serviceName);
    $("#task-creator").text(creator);
    $("#task-creator").attr("title", data.creatorName);
    $("#belong_workspace").text(data.workspaceName);
    $("#belong_theme").text(data.applicationName);
    $("#task-createTime").text(data.createTime);
    $.ajax({
        url: contextPath + '/api/ai/mine/publish/listJobInfo',
        type: 'post',
        dataType: 'json',
        data: {
            id: data.id
        },
        success: function (result) {
            if ("true" == result.flag) {
                var job = result.job;
                var taskStatusDesc = "生效";
                if (job.trigger.status == "PAUSED" || job.trigger.status == "PAUSED_BLOCKED") {
                    taskStatusDesc = '暂停';
                } else if (job.trigger.status == "COMPLETE") {
                    taskStatusDesc = '失效';
                } else if (job.trigger.status == "AWAIT") {
                    taskStatusDesc = '等待';
                }
                $('.rs-right-mid span[class="task-runtStatus"]').text(taskStatusDesc).attr("id", job.id);
                //解决360浏览器极速模式下样式不生效问题
                $("#task-runtStatus-div").css("float", "");
                $("#task-runtStatus-div").css("cssText", "float:right !important;padding-right: 50px;padding-top: 10px;")
            }
        }
    });

    $('.task-right-bot li.unsort').show();
    $(".task-right-bot-container").empty()
    $m.loadPage(contextPath + "/api/ai/app/view/overview?id=" + data.publishFlowIds + "&&t=" + TempoUtils.uuid() + "&&serviceId=" + data.publishFlowIds, $(".task-right-bot-container"));
    $("#overview").css("border-bottom-color", "#2E90E3");
    $("#overview").css("border-bottom-width", "initial");
    $("#overview").css("border-bottom-style", "inset");
    var loadTaskRightPage = function (job) {
        $('.task-right-bot li.unsort').show();
        $(".task-right-bot-container").empty()
        $m.loadPage(contextPath + "/api/ai/app/view/overview?id=" + data.publishFlowIds + "&&t=" + TempoUtils.uuid() + "&&serviceId=" + data.publishFlowIds, $(".task-right-bot-container"));
        $("#overview").css("border-bottom-color", "#2E90E3");
        $("#overview").css("border-bottom-width", "initial");
        $("#overview").css("border-bottom-style", "inset");
        $("#overview").off('click').on('click', function () {
            $(".task-right-bot-container").empty();
            $("#overview").css("border-bottom-color", "#2E90E3");
            $("#overview").css("border-bottom-width", "initial");
            $("#overview").css("border-bottom-style", "inset");
            $("#taskconfiguration").css("border-bottom", "none");
            $("#taskmonitor").css("border-bottom", "none");
            $(".ui-dialog-title").css("font-size", "14px");
            $(".ui-dialog-title").css("font-weight", "bold");
            $(".ui-dialog-title").css("color", "#445265");
            loadTaskRightPage(job);
        });
    }
    $("#overview").off('click').on('click', function () {
        $(".task-right-bot-container").empty();
        $("#overview").css("border-bottom-color", "#2E90E3");
        $("#overview").css("border-bottom-width", "initial");
        $("#overview").css("border-bottom-style", "inset");
        $("#taskconfiguration").css("border-bottom", "none");
        $("#taskmonitor").css("border-bottom", "none");
        loadTaskRightPage(data);
    });
    $("#taskconfiguration").off('click').on('click', function () {
        $(".ui-dialog-title").css("font-size", "14px");
        $(".ui-dialog-title").css("font-weight", "bold");
        $(".ui-dialog-title").css("color", "#445265");
        $(".task-right-bot-container").empty();
        $("#overview").css("border-bottom", "none");
        $("#taskmonitor").css("border-bottom", "none");
        $("#taskconfiguration").css("border-bottom-color", "#2E90E3");
        $("#taskconfiguration").css("border-bottom-width", "initial");
        $("#taskconfiguration").css("border-bottom-style", "inset");
        $m.loadPage(contextPath + "/api/ai/app/view/taskconfiguration?id=" + data.id + "&&t=" + TempoUtils.uuid() + "&&serviceId=" + data.publishFlowIds, $(".task-right-bot-container"));
    });
    $("#taskmonitor").off('click').on('click', function () {
        $(".ui-dialog-title").css("font-size", "14px");
        $(".ui-dialog-title").css("font-weight", "bold");
        $(".ui-dialog-title").css("color", "#445265");
        $(".task-right-bot-container").empty();
        $("#overview").css("border-bottom", "none");
        $("#taskconfiguration").css("border-bottom", "none");
        $("#taskmonitor").css("border-bottom-color", "#2E90E3");
        $("#taskmonitor").css("border-bottom-width", "initial");
        $("#taskmonitor").css("border-bottom-style", "inset");
        $m.loadPage(contextPath + "/api/ai/app/view/taskmonitor?id=" + data.id + "&&t=" + TempoUtils.uuid() + "&&serviceId=" + data.publishFlowIds, $(".task-right-bot-container"));
    })

});